<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <canvas id="canvas" style="width: 500;height: 500;background-color: gray;"></canvas>
  <script src="../lib/index.js"></script>
  <script>
    const ctx = document.getElementById('canvas')
    const gl = ctx.getContext('webgl')
    const vertexShaderSource = `
    attribute vec4 a_Position; 
    void main() {  
      gl_Position = a_Position;
      gl_PointSize = 30.0;
    }
    `
    const fragmentShaderSource = `
      void main() {
        gl_FragColor = vec4(1.0,0.0,0.0,1.0);
      }
    `
    const program = initShaders(gl, vertexShaderSource, fragmentShaderSource)

    // 设置a_Position值
    const a_Position = gl.getAttribLocation(program, 'a_Position')
    gl.vertexAttrib4f(a_Position, 0.5, 0.5, 0.0, 1.0)
    gl.drawArrays(gl.POINTS, 0, 1)
  </script>
</body>
</html>